package kt.com.bilin.coin.ui.activity

import android.content.Intent
import androidx.activity.viewModels
import com.bilin.coin.R
import kotlinx.android.synthetic.main.activity_test.*
import kt.com.bilin.coin.api.ApiObserver
import kt.com.bilin.coin.common.UserDataCache
import kt.com.bilin.coin.helper.*
import kt.com.bilin.coin.utils.ImageUploadUtils
import kt.com.bilin.coin.utils.Logger
import kt.com.bilin.coin.utils.selectImage
import kt.com.bilin.coin.viewmodel.UserViewModel
import java.io.File

class TestActivity : BaseActivity(R.layout.activity_test) {

    private val mUserViewModel: UserViewModel by viewModels()
    private val idnumberWord = "513029199407024933"
    private val nameWord = "周传亮"
    private val bestImagePath = "/data/user/0/com.bilin.coin/cache/face6625624195657376198.jpg"
    override fun initData() {
        /*mMainViewModel.appVersion(ApiObserver {
            Logger.e("==>${it}")
        })*/
        Logger.e("==>${UserDataCache.token}")
//        initOCR()
        banner.setOnClickListener {
            /*mUserViewModel.faceVerify(idnumberWord, nameWord, File(bestImagePath), ApiObserver {
                Logger.e("====>${it}")
            })*/
            //openOCRCardFront()
//            ImageUploadUtils(this) {
//                Logger.e("success====>${it}")
//            }.selectImage { }
        }
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
//        OCRCardFrontResult(requestCode, resultCode, data) { idnumberWord, nameWord ->
//            Logger.e("idnumberWord==>${idnumberWord}====nameWord==>${nameWord}")
//            openFace()
//        }
        faceResult(requestCode, resultCode, data) {
            Logger.e("bestImagePath==>${it}")
        }
    }
}